
/**  
* @Title: MetaDataFieldTemplate.java  
* @Package org.sapling.data.beans  
* @Description: TODO
* @author DcfZero  
* @date 2021年5月12日  
* @version V1.0  
*/ 
package org.sapling.data.beans;

import java.io.Serializable;
import java.util.Map;

import lombok.Data;
import lombok.Getter;

/**  
* TODO
* @ClassName: MetaDataFieldTemplate  
* @author DcfZero 
* @date 2021年5月12日  
*    
*/
@Getter
public class MetadataFieldTemplate implements Serializable{/**
	 * TODO
	 * @author DcfZero
	 */
	private static final long serialVersionUID = 1370991361661291615L;
	
	private String tableField;
	private String fieldDesc;
	private String fieldSeq;
	private String fieldType;
	private String fieldLength;
	private String fieldIsKey;
	private String fieldDict;
	private String fieldDictLimit;
	private String fieldIsNull;
	private String isShow;
	
	
	public MetadataFieldTemplate(Map<String,Object> template) {
		if(!template.isEmpty()) {
			this.setTableField(String.valueOf(template.get("table_field")));
			this.setFieldDesc(String.valueOf(template.get("field_desc")));
			this.setFieldSeq(String.valueOf(template.get("field_seq")));
			this.setFieldType(String.valueOf(template.get("field_type")));
			this.setFieldLength(String.valueOf(template.get("field_length")));
			this.setFieldIsKey(String.valueOf(template.get("field_iskey")));
			this.setFieldDict(String.valueOf(template.get("field_dict")));
			this.setFieldDictLimit(String.valueOf(template.get("field_dict_limit")));
			this.setFieldIsNull(String.valueOf(template.get("field_isnull")));
			this.setIsShow(String.valueOf(template.get("is_show")));
		}
	}
	
	public boolean isNull() {
		return this.getFieldIsNull().equals("Y") ? true : false;
	}
	
	public boolean isKey() {
		return this.getFieldIsKey().equals("Y") ? true : false;
	}

	private void setTableField(String tableField) {
		this.tableField = tableField;
	}

	private void setFieldDesc(String fieldDesc) {
		this.fieldDesc = fieldDesc;
	}

	private void setFieldSeq(String fieldSeq) {
		this.fieldSeq = fieldSeq;
	}

	private void setFieldType(String fieldType) {
		this.fieldType = fieldType;
	}

	private void setFieldLength(String fieldLength) {
		this.fieldLength = fieldLength;
	}

	private void setFieldIsKey(String fieldIsKey) {
		this.fieldIsKey = fieldIsKey;
	}

	private void setFieldDict(String fieldDict) {
		this.fieldDict = fieldDict;
	}

	private void setFieldDictLimit(String fieldDictLimit) {
		this.fieldDictLimit = fieldDictLimit;
	}

	private void setIsShow(String isShow) {
		this.isShow = isShow;
	}

	private void setFieldIsNull(String fieldIsNull) {
		this.fieldIsNull = fieldIsNull;
	}

	
	
	
}
